///Project: Introducing GLP Paper Table 7 IMputed data
///Author: Erzen Oncel 
///Date: 31 May 2015 
///Stata 13

*************************TABLE 7***********************************************
clear all
use  "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/eduwest_mi8.dta"

/*1	"agronomy"
2"economics / business / management"
3"engineering"
4"mathematics / computer science"
5"biology/chemistry/physics"
6"humanities"
7"social sciences"
8"law"
9"medicine"
10"military"
11"other"*/
gen temp=1
drop if edumajor1==0
count
count if power==1
count if power==3
count if office1==2
count if office1==7
count if office1==6
count if wealth==0
count if wealth==1
count if region==1
count if region==2
count if region==3
count if region==4
count if region==5
count if regime==0
count if regime==1
tab edumajor1
save "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta", replace
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
duplicates drop country_nid, force
count

clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if power==1
duplicates drop country_nid, force
count

clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if power==3
duplicates drop country_nid, force
count

clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==2
duplicates drop country_nid, force
count

clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==6
duplicates drop country_nid, force
count

clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==7
duplicates drop country_nid, force
count

clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if wealth==0
duplicates drop country_nid, force
count

clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if wealth==1
duplicates drop country_nid, force
count

clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if regime==0
duplicates drop country_nid, force
count

clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if regime==1
duplicates drop country_nid, force
count

clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if region==1
duplicates drop country_nid, force
count

clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if region==2
duplicates drop country_nid, force
count

clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if region==3
duplicates drop country_nid, force
count

clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if region==4
duplicates drop country_nid, force
count

clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if region==5
duplicates drop country_nid, force
count

**agronomy**
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
sort country_nid
by country_nid: egen agron=total(temp) if edumajor1==1
by country_nid: egen alldegrees=total(temp)
gen percentage=agron/alldegrees*100
keep if agron<.
duplicates drop country_nid, force
merge m:1 country_nid using "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Publication/PoP/Submission 2 (Bernhard)/Round 3/Replicationdata/Country_list.dta"
replace percentage=0 if _merge==2
sum percentage
return list
gen percentage1=r(sum)/145
sum percentage if wealth==1
sum percentage if wealth==0
sum percentage if regime==0
sum percentage if regime==1
sum percentage if region==1
sum percentage if region==2
sum percentage if region==3
sum percentage if region==4
sum percentage if region==5
*apex
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if power==1
sort country_nid
by country_nid: egen agron=total(temp) if edumajor1==1
by country_nid: egen alledu=total(temp)
gen percentage=agron/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*top ten
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if power==3
sort country_nid
by country_nid: egen agron=total(temp) if edumajor1==1
by country_nid: egen alledu=total(temp)
gen percentage=agron/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*cabinet
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==2 
sort country_nid
by country_nid: egen agron=total(temp) if edumajor1==1
by country_nid: egen alledu=total(temp)
gen percentage=agron/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*court 
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==7 
sort country_nid
by country_nid: egen agron=total(temp) if edumajor1==1
by country_nid: egen alledu=total(temp)
gen percentage=agron/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*MPs
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==6
sort country_nid
by country_nid: egen agron=total(temp) if edumajor1==1
by country_nid: egen alledu=total(temp)
gen percentage=agron/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
//////////////////////////////
**econ/bus/man**
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
sort country_nid
by country_nid: egen econ=total(temp) if edumajor1==2
by country_nid: egen alldegrees=total(temp)
gen percentage=econ/alldegrees*100
keep if econ<.
duplicates drop country_nid, force
merge m:1 country_nid using "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Publication/PoP/Submission 2 (Bernhard)/Round 3/Replicationdata/Country_list.dta"
replace percentage=0 if _merge==2
sum percentage
return list
gen percentage1=r(sum)/145
sum percentage if wealth==1
sum percentage if wealth==0
sum percentage if regime==0
sum percentage if regime==1
sum percentage if region==1
sum percentage if region==2
sum percentage if region==3
sum percentage if region==4
sum percentage if region==5
*apex
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if power==1
sort country_nid
by country_nid: egen econ=total(temp) if edumajor1==2
by country_nid: egen alledu=total(temp)
gen percentage=econ/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*top ten
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if power==3
sort country_nid
by country_nid: egen econ=total(temp) if edumajor1==2
by country_nid: egen alledu=total(temp)
gen percentage=econ/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*cabinet
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==2 
sort country_nid
by country_nid: egen econ=total(temp) if edumajor1==2
by country_nid: egen alledu=total(temp)
gen percentage=econ/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*court 
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==7 
sort country_nid
by country_nid: egen econ=total(temp) if edumajor1==2
by country_nid: egen alledu=total(temp)
gen percentage=econ/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*MPs
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==6
sort country_nid
by country_nid: egen econ=total(temp) if edumajor1==2
by country_nid: egen alledu=total(temp)
gen percentage=econ/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
////////////////////////////////////////////
**engineering**
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
sort country_nid
by country_nid: egen eng=total(temp) if edumajor1==3
by country_nid: egen alldegrees=total(temp)
gen percentage=eng/alldegrees*100
keep if eng<.
duplicates drop country_nid, force
merge m:1 country_nid using "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Publication/PoP/Submission 2 (Bernhard)/Round 3/Replicationdata/Country_list.dta"
replace percentage=0 if _merge==2
sum percentage
return list
gen percentage1=r(sum)/145
sum percentage if wealth==1
sum percentage if wealth==0
sum percentage if regime==0
sum percentage if regime==1
sum percentage if region==1
sum percentage if region==2
sum percentage if region==3
sum percentage if region==4
sum percentage if region==5
*apex
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if power==1
sort country_nid
by country_nid: egen eng=total(temp) if edumajor1==3
by country_nid: egen alledu=total(temp)
gen percentage=eng/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*top ten
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if power==3
sort country_nid
by country_nid: egen eng=total(temp) if edumajor1==3
by country_nid: egen alledu=total(temp)
gen percentage=eng/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*cabinet
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==2 
sort country_nid
by country_nid: egen eng=total(temp) if edumajor1==3
by country_nid: egen alledu=total(temp)
gen percentage=eng/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*court 
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==7 
sort country_nid
by country_nid: egen eng=total(temp) if edumajor1==3
by country_nid: egen alledu=total(temp)
gen percentage=eng/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*MPs
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==6
sort country_nid
by country_nid: egen eng=total(temp) if edumajor1==3
by country_nid: egen alledu=total(temp)
gen percentage=eng/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
//////////////////////////////////////////////////
**math-cs**
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"

sort country_nid
by country_nid: egen math=total(temp) if edumajor1==4
by country_nid: egen alldegrees=total(temp)
gen percentage=math/alldegrees*100
keep if math<.
duplicates drop country_nid, force
merge m:1 country_nid using "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Publication/PoP/Submission 2 (Bernhard)/Round 3/Replicationdata/Country_list.dta"
replace percentage=0 if _merge==2
sum percentage
return list
gen percentage1=r(sum)/145
sum percentage if wealth==1
sum percentage if wealth==0
sum percentage if regime==0
sum percentage if regime==1
sum percentage if region==1
sum percentage if region==2
sum percentage if region==3
sum percentage if region==4
sum percentage if region==5
*apex
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"

keep if power==1
sort country_nid
by country_nid: egen math=total(temp) if edumajor1==4
by country_nid: egen alledu=total(temp)
gen percentage=math/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*top ten
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"

keep if power==3
sort country_nid
by country_nid: egen math=total(temp) if edumajor1==4
by country_nid: egen alledu=total(temp)
gen percentage=math/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*cabinet
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"

keep if office1==2 
sort country_nid
by country_nid: egen math=total(temp) if edumajor1==4
by country_nid: egen alledu=total(temp)
gen percentage=math/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*court 
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"

keep if office1==7 
sort country_nid
by country_nid: egen math=total(temp) if edumajor1==4
by country_nid: egen alledu=total(temp)
gen percentage=math/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*MPs
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"

keep if office1==6
sort country_nid
by country_nid: egen math=total(temp) if edumajor1==4
by country_nid: egen alledu=total(temp)
gen percentage=math/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
//////////////////////////////////////////////////
**bio/chem/phys**
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"

sort country_nid
by country_nid: egen bio=total(temp) if edumajor1==5
by country_nid: egen alldegrees=total(temp)
gen percentage=bio/alldegrees*100
keep if bio<.
duplicates drop country_nid, force
merge m:1 country_nid using "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Publication/PoP/Submission 2 (Bernhard)/Round 3/Replicationdata/Country_list.dta"
replace percentage=0 if _merge==2
sum percentage
return list
gen percentage1=r(sum)/146
sum percentage if wealth==1
sum percentage if wealth==0
sum percentage if regime==0
sum percentage if regime==1
sum percentage if region==1
sum percentage if region==2
sum percentage if region==3
sum percentage if region==4
sum percentage if region==5
*apex
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if power==1
sort country_nid
by country_nid: egen bio=total(temp) if edumajor1==5
by country_nid: egen alledu=total(temp)
gen percentage=bio/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*top ten
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if power==3
sort country_nid
by country_nid: egen bio=total(temp) if edumajor1==5
by country_nid: egen alledu=total(temp)
gen percentage=bio/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*cabinet
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==2 
sort country_nid
by country_nid: egen bio=total(temp) if edumajor1==5
by country_nid: egen alledu=total(temp)
gen percentage=bio/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*court 
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==7 
sort country_nid
by country_nid: egen bio=total(temp) if edumajor1==5
by country_nid: egen alledu=total(temp)
gen percentage=bio/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*MPs
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==6
sort country_nid
by country_nid: egen bio=total(temp) if edumajor1==5
by country_nid: egen alledu=total(temp)
gen percentage=bio/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
//////////////////////////////////////////////////
**Humanities**
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
sort country_nid
by country_nid: egen humanities=total(temp) if edumajor1==6
by country_nid: egen alldegrees=total(temp)
gen percentage=humanities/alldegrees*100
keep if humanities<.
duplicates drop country_nid, force
merge m:1 country_nid using "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Publication/PoP/Submission 2 (Bernhard)/Round 3/Replicationdata/Country_list.dta"
replace percentage=0 if _merge==2
sum percentage
return list
gen percentage1=r(sum)/145
sum percentage if wealth==1
sum percentage if wealth==0
sum percentage if regime==0
sum percentage if regime==1
sum percentage if region==1
sum percentage if region==2
sum percentage if region==3
sum percentage if region==4
sum percentage if region==5
*apex
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if power==1
sort country_nid
by country_nid: egen humanities=total(temp) if edumajor1==6
by country_nid: egen alledu=total(temp)
gen percentage=humanities/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*top ten
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if power==3
sort country_nid
by country_nid: egen humanities=total(temp) if edumajor1==6
by country_nid: egen alledu=total(temp)
gen percentage=humanities/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*cabinet
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==2 
sort country_nid
by country_nid: egen humanities=total(temp) if edumajor1==6
by country_nid: egen alledu=total(temp)
gen percentage=humanities/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*court 
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==7 
sort country_nid
by country_nid: egen humanities=total(temp) if edumajor1==6
by country_nid: egen alledu=total(temp)
gen percentage=humanities/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*MPs
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==6
sort country_nid
by country_nid: egen humanities=total(temp) if edumajor1==6
by country_nid: egen alledu=total(temp)
gen percentage=humanities/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
/////////////////////////////////////////////////
**Social Sciences**
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
sort country_nid
by country_nid: egen socsci=total(temp) if edumajor1==7
by country_nid: egen alldegrees=total(temp)
gen percentage=socsci/alldegrees*100
keep if socsci<.
duplicates drop country_nid, force
merge m:1 country_nid using "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Publication/PoP/Submission 2 (Bernhard)/Round 3/Replicationdata/Country_list.dta"
replace percentage=0 if _merge==2
sum percentage
return list
gen percentage1=r(sum)/145
sum percentage if wealth==1
sum percentage if wealth==0
sum percentage if regime==0
sum percentage if regime==1
sum percentage if region==1
sum percentage if region==2
sum percentage if region==3
sum percentage if region==4
sum percentage if region==5
*apex
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if power==1
sort country_nid
by country_nid: egen socsci=total(temp) if edumajor1==7
by country_nid: egen alledu=total(temp)
gen percentage=socsci/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*top ten
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if power==3
sort country_nid
by country_nid: egen socsci=total(temp) if edumajor1==7
by country_nid: egen alledu=total(temp)
gen percentage=socsci/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*cabinet
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==2 
sort country_nid
by country_nid: egen socsci=total(temp) if edumajor1==7
by country_nid: egen alledu=total(temp)
gen percentage=socsci/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*court 
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==7 
sort country_nid
by country_nid: egen socsci=total(temp) if edumajor1==7
by country_nid: egen alledu=total(temp)
gen percentage=socsci/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*MPs
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==6
sort country_nid
by country_nid: egen socsci=total(temp) if edumajor1==7
by country_nid: egen alledu=total(temp)
gen percentage=socsci/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
////////////////////////////////////////
**law degree**
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
sort country_nid
by country_nid: egen law=total(temp) if edumajor1==8
by country_nid: egen alldegrees=total(temp)
gen percentage=law/alldegrees*100
keep if law<.
duplicates drop country_nid, force
merge m:1 country_nid using "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Publication/PoP/Submission 2 (Bernhard)/Round 3/Replicationdata/Country_list.dta"
replace percentage=0 if _merge==2
sum percentage
return list
gen percentage1=r(sum)/145
sum percentage if wealth==1
sum percentage if wealth==0
sum percentage if regime==0
sum percentage if regime==1
sum percentage if region==1
sum percentage if region==2
sum percentage if region==3
sum percentage if region==4
sum percentage if region==5
*apex
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if power==1
sort country_nid
by country_nid: egen law=total(temp) if edumajor1==8
by country_nid: egen alledu=total(temp)
gen percentage=law/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*top ten
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"

keep if power==3
sort country_nid
by country_nid: egen law=total(temp) if edumajor1==8
by country_nid: egen alledu=total(temp)
gen percentage=law/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*cabinet
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==2 
sort country_nid
by country_nid: egen law=total(temp) if edumajor1==8
by country_nid: egen alledu=total(temp)
gen percentage=law/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*court 
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==7 
sort country_nid
by country_nid: egen law=total(temp) if edumajor1==8
by country_nid: egen alledu=total(temp)
gen percentage=law/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*MPs
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==6
sort country_nid
by country_nid: egen law=total(temp) if edumajor1==8
by country_nid: egen alledu=total(temp)
gen percentage=law/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
///////////////////////////////////////////
**medicine**
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
sort country_nid
by country_nid: egen med=total(temp) if edumajor1==9
by country_nid: egen alldegrees=total(temp)
gen percentage=med/alldegrees*100
keep if med<.
duplicates drop country_nid, force
merge m:1 country_nid using "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Publication/PoP/Submission 2 (Bernhard)/Round 3/Replicationdata/Country_list.dta"
replace percentage=0 if _merge==2
sum percentage
return list
gen percentage1=r(sum)/145
sum percentage if wealth==1
sum percentage if wealth==0
sum percentage if regime==0
sum percentage if regime==1
sum percentage if region==1
sum percentage if region==2
sum percentage if region==3
sum percentage if region==4
sum percentage if region==5
*apex
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if power==1
sort country_nid
by country_nid: egen med=total(temp) if edumajor1==9
by country_nid: egen alledu=total(temp)
gen percentage=med/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*top ten
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if power==3
sort country_nid
by country_nid: egen med=total(temp) if edumajor1==9
by country_nid: egen alledu=total(temp)
gen percentage=med/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*cabinet
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==2 
sort country_nid
by country_nid: egen med=total(temp) if edumajor1==9
by country_nid: egen alledu=total(temp)
gen percentage=med/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*court 
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==7 
sort country_nid
by country_nid: egen med=total(temp) if edumajor1==9
by country_nid: egen alledu=total(temp)
gen percentage=med/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*MPs
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==6
sort country_nid
by country_nid: egen med=total(temp) if edumajor1==9
by country_nid: egen alledu=total(temp)
gen percentage=med/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
///////////////////////////////////////////////////////////
**military**
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
sort country_nid
by country_nid: egen military=total(temp) if edumajor1==10
by country_nid: egen alldegrees=total(temp)
gen percentage=military/alldegrees*100
keep if military<.
duplicates drop country_nid, force
merge m:1 country_nid using "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Publication/PoP/Submission 2 (Bernhard)/Round 3/Replicationdata/Country_list.dta"
replace percentage=0 if _merge==2
sum percentage
return list
gen percentage1=r(sum)/145
sum percentage if wealth==1
sum percentage if wealth==0
sum percentage if regime==0
sum percentage if regime==1
sum percentage if region==1
sum percentage if region==2
sum percentage if region==3
sum percentage if region==4
sum percentage if region==5
*apex
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if power==1
sort country_nid
by country_nid: egen mil=total(temp) if edumajor1==10
by country_nid: egen alledu=total(temp)
gen percentage=mil/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*top ten
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if power==3
sort country_nid
by country_nid: egen mil=total(temp) if edumajor1==10
by country_nid: egen alledu=total(temp)
gen percentage=mil/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*cabinet
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==2 
sort country_nid
by country_nid: egen mil=total(temp) if edumajor1==10
by country_nid: egen alledu=total(temp)
gen percentage=mil/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*court 
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==7 
sort country_nid
by country_nid: egen mil=total(temp) if edumajor1==10
by country_nid: egen alledu=total(temp)
gen percentage=mil/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*MPs
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==6
sort country_nid
by country_nid: egen mil=total(temp) if edumajor1==10
by country_nid: egen alledu=total(temp)
gen percentage=mil/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
/////////////////////////////////////////////
**other**
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
sort country_nid
by country_nid: egen other=total(temp) if edumajor1==11
by country_nid: egen alldegrees=total(temp)
gen percentage=other/alldegrees*100
keep if other<.
duplicates drop country_nid, force
merge m:1 country_nid using "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Publication/PoP/Submission 2 (Bernhard)/Round 3/Replicationdata/Country_list.dta"
replace percentage=0 if _merge==2
sum percentage
return list
gen percentage1=r(sum)/145
sum percentage if wealth==1
sum percentage if wealth==0
sum percentage if regime==0
sum percentage if regime==1
sum percentage if region==1
sum percentage if region==2
sum percentage if region==3
sum percentage if region==4
sum percentage if region==5
*apex
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if power==1
sort country_nid
by country_nid: egen other=total(temp) if edumajor1==11
by country_nid: egen alledu=total(temp)
gen percentage=other/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*top ten
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if power==3
sort country_nid
by country_nid: egen other=total(temp) if edumajor1==11
by country_nid: egen alledu=total(temp)
gen percentage=other/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*cabinet
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==2 
sort country_nid
by country_nid: egen other=total(temp) if edumajor1==11
by country_nid: egen alledu=total(temp)
gen percentage=other/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*court 
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==7 
sort country_nid
by country_nid: egen other=total(temp) if edumajor1==11
by country_nid: egen alledu=total(temp)
gen percentage=other/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage
*MPs
clear all
use "/Users/erzeno/Dropbox/GLP/JG_EO_Papers/Introducing GLP Paper/Do-files/imputed_analysis/edumajor.dta"
keep if office1==6
sort country_nid
by country_nid: egen other=total(temp) if edumajor1==11
by country_nid: egen alledu=total(temp)
gen percentage=other/alledu*100
replace percentage=0 if missing(percentage)
collapse (max) percentage, by(country_nid)
sum percentage

